package pl.edu.mimuw.irs.core.model.design.exception;

/**
 * @author Jakub Rauch
 * Created on: 2009-05-07
 */
public class InternalDesignException extends RuntimeException {

	// *** Attributes

	// Required id
	private static final long serialVersionUID = -971661464060465302L;
	// Cause of this exception
	private DesignCause cause;
	private Object[] opts;
	
	// *** Methods
	

	public InternalDesignException(DesignCause cause, Object... opts) {
		this.cause = cause;
		this.opts = opts;
	}
	
	@Override
	public String toString() {
		StringBuffer stringBuffer = new StringBuffer();
		stringBuffer.append("InternalException." + cause.toString());
		if (opts != null && opts.length > 0) {
			stringBuffer.append("[");
			for (Object opt : opts) {
				stringBuffer.append(opt);
				stringBuffer.append(",");
			}
			stringBuffer.replace(stringBuffer.lastIndexOf(","), 
					stringBuffer.length(), "]");
		}
		
		return stringBuffer.toString();
	}

	// *** Enums

	public enum DesignCause {
		UNKNOWN_NODE_TYPE, 
		UNSUPPORTED_REFINEMENT_TYPE, 
		TRANSITION_NEGATIVE_CHANCE,
		NOT_ALLOWED_ARC_NODES, 
		NOT_IRS_ARC, 
		NOT_IRS_NODE, 
		NOT_IRS_PLACE, 
		NOT_IRS_TRANSITION,
		NOT_IRS_REQUIREMENT, 
		NOT_IRS_ACTIVITY, 
		NOT_IRS_WORKFLOW, 
		NOT_TRANSITION, 
		INCOMPATIBLE_COPY_NODES, 
		CO_ACTIVITY_NOT_FOUND,
		CO_REQUIREMENT_NOT_FOUND, 
		NET_MEMBER_WITHOUT_ID_MANAGER, 
		FINAL_FIELD_OVERRIDE, 
		UNSUPPORTED_ARC_NODES, 
		CLONE_NOT_IMPLEMENTED;
	}
}
